<template>
  <div id="root">
    <router-view />
  </div>
</template>

<script>
export default {
  methods: {
    checkToken() {
      if (window.location.hash == "#" || window.location.hash == "#/login") {
        return;
      }
      if (
        (localStorage.getItem("token") != null) &
        (localStorage.getItem("userId") != null) &
        (localStorage.getItem("userName") != null) &
        (localStorage.getItem("admin") != null)
      ) {
        return;
      }
      window.location = "/#/login";
    },
  },
  mounted() {
    setInterval(() => {
      this.checkToken();
    }, 500);
  },
};
</script>

<style>
@font-face {
  font-family: "SourceHanSansSCMedium";
  src: url("./font/SourceHanSansSC-Medium.otf");
}

@font-face {
  font-family: "SourceHanSansSC";
  src: url("./font/SourceHanSansSC-Normal.otf");
}

@font-face {
  font-family: "DS-DIGI-1";
  src: url("./font/DS-DIGI-1.ttf");
}

#root {
  height: 99.87vh;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "SourceHanSansSC";
}

.el-main {
  background: linear-gradient(
    170deg,
    hsla(12, 100%, 96%, 0.274),
    hsla(212, 98%, 59%, 0.267)
  );
}

.card {
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  box-shadow: 2px 1px 7px rgb(88, 88, 88, 0.2);
}

.card > #title {
  font-size: 20px;
}

.blue {
  color: #205391;
}
.blue_2 {
  color: #3277a2;
}
.green {
  color: #33ff99;
}
.el-button {
  box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);
}
</style>
